@extends('backend::common.common_right')
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>添加/编辑管理员</h5>
                        <div class="ibox-tools">
                            <a class="close-link" href="javascript:history.go(-1);">
                                <i class="fa fa-times" ></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal m-t"  action="{{url('backend/adminedit')}}" method="post" id="signupForm">
                            {{ csrf_field() }}
                            <input type="hidden" name="id" value="{{$admin->id or 0}}">
                            <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                                <label class="col-sm-3 control-label">用户名：</label>
                                <div class="col-sm-8">
                                    <input type="text" value="{{ $admin->name or '' }}" name="name" class="form-control" placeholder="用户名" id="title">
                                    @if ($errors->has('name'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                                <label class="col-sm-3 control-label">密码：</label>
                                <div class="col-sm-8">
                                    <input type="password" id="password" value="" name="password" class="form-control" placeholder="密码" id="title">
                                    @if ($errors->has('password'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                        </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">确认密码：</label>
                                <div class="col-sm-8">
                                    <input type="password" value="" name="confirm_password" class="form-control" placeholder="确认密码" id="title">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">角色：</label>
                                <div class="col-sm-8">
                                    <select class="form-control m-b" name="level">
                                        <option value="1">运营（部分权限）</option>
                                        <option value="2">客服 （部分权限）</option>
                                        <option value="3">超级管理员（所有权限）</option>
                                    </select>
                                </div>
                            </div>
                            @isset($admin->id)
                            @if($admin->id == 1)
                                <input type="hidden" name="level" value="3">
                            @endif
                            @endisset
                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <button class="btn btn-primary" type="submit">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection